package com.example.micinter_ipcamera;

import android.util.Size;

public class CameraSettings {
    public enum Resolution {
        LOW("低 (320x240)", new Size(320, 240)),
        MEDIUM("中 (640x480)", new Size(640, 480)),
        HIGH("高 (1280x720)", new Size(1280, 720)),
        VERY_HIGH("超高 (1920x1080)", new Size(1920, 1080));

        private final String label;
        private final Size size;

        Resolution(String label, Size size) {
            this.label = label;
            this.size = size;
        }

        public String getLabel() {
            return label;
        }

        public Size getSize() {
            return size;
        }

        @Override
        public String toString() {
            return label;
        }
    }

    public enum Quality {
        LOW(50, "低 (50)"),
        MEDIUM(70, "中 (70)"),
        HIGH(85, "高 (85)"),
        VERY_HIGH(95, "超高 (95)");

        private final int value;
        private final String label;

        Quality(int value, String label) {
            this.value = value;
            this.label = label;
        }

        public int getValue() {
            return value;
        }

        @Override
        public String toString() {
            return label;
        }
    }

    // 使用较低默认值以提高流畅度和降低延迟
    private Resolution resolution = Resolution.LOW;
    private Quality quality = Quality.LOW;
    private boolean useBackCamera = true;

    public Resolution getResolution() {
        return resolution;
    }

    public void setResolution(Resolution resolution) {
        this.resolution = resolution;
    }

    public Quality getQuality() {
        return quality;
    }

    public void setQuality(Quality quality) {
        this.quality = quality;
    }

    public boolean isUseBackCamera() {
        return useBackCamera;
    }

    public void setUseBackCamera(boolean useBackCamera) {
        this.useBackCamera = useBackCamera;
    }

    public void toggleCamera() {
        useBackCamera = !useBackCamera;
    }
}

